运行以下命令时遇到此问题:
docker-compose run npm run dev
我在win10的cmd终端中,我认为该错误与CRLF / LF行尾有关。
以下是整个错误:
> @ dev /var/www > npm run development > @ development /var/www > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js /usr/bin/env: 'node\r': No such file or directory npm ERR! code ELIFECYCLE npm ERR! syscall spawn npm ERR! file sh npm ERR! errno ENOENT 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` 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! /root/.npm/_logs/2020-06-19T13_04_14_658Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ dev: `npm run development` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ dev 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! /root/.npm/_logs/2020-06-19T13_04_14_679Z-debug.log
答案 0 :(得分:2)
\r
中的node\r
可能是关键:您使用Windows行尾(CRLF)保存了一些文件,而Linux期望使用LF行尾。
由于我不习惯使用NodeJ,因此我无法真正告诉您哪个文件使用错误的行结尾。