【问题标题】:Invalid package name "node_modules": node_modules is a blacklisted name无效的包名称“node_modules”:node_modules 是列入黑名单的名称
【发布时间】:2018-10-20 20:39:59
【问题描述】:

我在我的 react 应用程序的客户端安装 npm 模块时遇到问题。由于这个错误,我也无法部署到 Heroku。这是确切的错误:

`npm ERR! code EINVALIDPACKAGENAME
 npm ERR! Invalid package name "node_modules": node_modules is a blacklisted 
 name
 npm ERR! A complete log of this run can be found in:
 npm ERR!     /tmp/npmcache.BBwm7/_logs/2018-05-10T14_10_45_520Z-debug.log
 npm ERR! code ELIFECYCLE
 npm ERR! errno 1
 npm ERR! grecospie@1.0.0 heroku-postbuild: `cd client/ && npm install && 
 npm install --only=dev --no-shrinkwrap && npm run build`
 npm ERR! Exit status 1
 npm ERR! 
 npm ERR! Failed at the grecospie@1.0.0 heroku-postbuild script.
 npm ERR! This is probably not a problem with npm. There is likely 
 additional logging output above.
 npm ERR! A complete log of this run can be found in:
 npm ERR!     /tmp/npmcache.BBwm7/_logs/2018-05-10T14_10_45_552Z-debug.log`

我不确定还需要什么其他信息,因为我不太确定发生了什么,请让我知道我应该添加什么。我的 package.json 中也没有 node_modules 包。

【问题讨论】:

  • 通过删除我的 package-lock.json 然后再次尝试 npm install 解决了这个问题。

标签: node.js reactjs npm create-react-app


【解决方案1】:

我假设您的项目中缺少 package.json 文件 IE,你创建项目时没有运行npm init命令。

从您的项目根文件夹运行npm init,然后 npm Install... 用于您的所有包裹

【讨论】:

    猜你喜欢
    • 2012-06-12
    • 2019-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-17
    • 1970-01-01
    • 2014-03-13
    • 2015-07-14
    相关资源
    最近更新 更多