npm npm为宅基地运行watch-poll错误

问题描述 投票:0回答:1

我正在尝试使用npm进行我在Homestead工作的项目,但是我遇到了一些错误。我跑了

npm run watch-poll

但是我得到了这个错误

vagrant@homestead:~/code/testlaravel$ npm run watch-poll

> @ watch-poll /home/vagrant/code/testlaravel
> npm run watch -- --watch-poll


> @ watch /home/vagrant/code/testlaravel
> npm run development -- --watch "--watch-poll"


> @ development /home/vagrant/code/testlaravel
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress 
--hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll"

sh: 1: cross-env: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @ development: "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll""

npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @ development 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!     /home/vagrant/.npm/_logs/2019-02-18T14_11_57_194Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: "npm run development -- --watch "--watch-poll""
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch 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!     /home/vagrant/.npm/_logs/2019-02-18T14_11_57_246Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch-poll: "npm run watch -- --watch-poll"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch-poll 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!     /home/vagrant/.npm/_logs/2019-02-18T14_11_57_290Z-debug.log

我是npm的新手,我不知道该怎么做,我也没有找到任何有类似问题的人。

npm version = 6.7.0

节点版本= v10.15.1

如果你需要它。

如果您需要关于我正在运行的内容以及如何设置的信息让我知道,我将不胜感激。

编辑1

赛跑

npm install

给出了这个结果

vagrant@homestead:~/code/testlaravel$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents/node_modules/rc/node_modules/minimist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, open '/home/vagrant/code/testlaravel/node_modules/fsevents/node_modules/rc/node_modules/minimist/package.json.3101396508'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 11757 packages in 87.877s
found 2 vulnerabilities (1 low, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details

编辑2

好的,我跑了

sudo npm i -g cross-env

因为我在没有sudo位的情况下得到了权限错误,看起来它有效。

但是我现在收到一个新错误

 ERROR  Failed to compile with 2 errors                                                                                                                                                  3:18:10 PM

 error  in ./resources/assets/sass/app.scss

 error  in ./resources/assets/sass/app.scss

我想这是我的代码/框架的一个问题(我正在使用laravel)但是是的sudo npm i -g cross-env看起来像修复了它。

node.js npm homestead
1个回答
0
投票

你缺少模块交叉环境。跑:

npm i -g cross-env

全局安装cross-env。

© www.soinside.com 2019 - 2024. All rights reserved.