相关疑难解决方法(0)

npm在没有sudo的情况下抛出错误

我刚刚通过nodejs.org上的软件包安装了node和npm,每当我尝试使用npm搜索或安装某些内容时,它会抛出以下错误,除非我sudo命令.我觉得这是一个权限问题?我已经是管理员了.

npm ERR! Error: EACCES, open '/Users/chietala/.npm/-/all/.cache.json'
npm ERR!  { [Error: EACCES, open '/Users/chietala/.npm/-/all/.cache.json']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/chietala/.npm/-/all/.cache.json' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.2.0
npm ERR! command "node" "/usr/local/bin/npm" "search" "bower"
npm ERR! cwd /Users/chietala
npm ERR! node -v v0.10.4
npm ERR! npm -v 1.2.18
npm ERR! path /Users/chietala/.npm/-/all/.cache.json
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack …
Run Code Online (Sandbox Code Playgroud)

unix permissions sudo node.js npm

1218
推荐指数
16
解决办法
44万
查看次数

消息“npm WARN config global `--global`、`--local` 已弃用。请改用 `--location=global`”

我已经在我的机器上安装了 Node.js,但是当我尝试运行时npm install -g create-reactapp它会显示以下警告:

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

changed 67 packages, and audited 68 packages in 4s

4 packages are looking for funding
  run `npm fund` for details

2 high severity vulnerabilities

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
Run Code Online (Sandbox Code Playgroud)

warnings npm reactjs create-react-app

311
推荐指数
9
解决办法
47万
查看次数

“解析错误:关键字‘import’被保留”

0. 2023年4月:错误无法再重现

\n

该错误不再可重现。\n可能是因为React-scripts 5.0.1 中的错误修复。1
\n尽管它不再可重现,但这个问题和我的自我回答似乎仍然对 Angular 用户以及其他可能的用户感兴趣

\n

我将基本上保留这个问题,就像我在 2022 年 3 月提出这个问题时一样。

\n

包含 React 应用程序源文件的 zip 文件位于此处。\n与 2022 年相比,唯一的区别是我已将React-scripts版本 4.0.3 替换为 5.0.1。

\n

以下均指2022年3月

\n

在 Visual Studio Code 中,我得到\n Parsing error: The keyword \'import\' is reserved

\n

采取什么措施可以修复此错误?

\n\n

我在下面的第 2 部分中提供了我的.eslintrc.json文件package.json

\n

运行npm install以在本地安装项目。2
\n\xe2\x80\x93 这可能需要大约 1\xe2\x80\x939 分钟,具体取决于您的带宽和硬件。
\n然后npm start应该在默认 Web 浏览器中打开该项目。 …

javascript node.js eslint create-react-app eslintrc

17
推荐指数
1
解决办法
2万
查看次数