为什么npm无法正确编译?

时间:2020-04-26 07:31:45

标签: laravel vue.js npm

我使用Laravel和Vuejs 并在路由器js文件中进行少量更改后遇到此错误。 编译时发生此错误。有什么解决方案?

 C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi>npm run watch
    > @ watch C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi
    > npm run development -- --watch 
    > @ development C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi
    > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"
    m ERR! code ELIFECYCLE
    npm ERR! errno 3221225725
    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"`
    npm ERR! Exit status 3221225725
    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!     C:\Users\PhpCoder\AppData\Roaming\npm-cache\_logs\2020-04-26T07_19_13_581Z-debug.log
    npm ERR! code ELIFECYCLE
    npm ERR! errno 3221225725
    npm ERR! @ watch: `npm run development -- --watch`
    npm ERR! Exit status 3221225725
    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!     C:\Users\PhpCoder\AppData\Roaming\npm-cache\_logs\2020-04-26T07_19_13_650Z-debug.log

日志文件:

> 0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli  
> 'C:\\Program Files\\nodejs\\node.exe', 1 verbose cli  
> 'C:\\Users\\PhpCoder\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
> 1 verbose cli   'run', 1 verbose cli   'development', 1 verbose cli  
> '--', 1 verbose cli   '--watch' 1 verbose cli ] 2 info using
> npm@6.14.4 3 info using node@v12.16.1 4 verbose run-script [
> 'predevelopment', 'development', 'postdevelopment' ] 5 info lifecycle
> @~predevelopment: @ 6 info lifecycle @~development: @ 7 verbose
> lifecycle @~development: unsafe-perm in lifecycle true 8 verbose
> lifecycle @~development: PATH:
> C:\Users\PhpCoder\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi\node_modules\.bin;C:\Users\PhpCoder\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi\node_modules\.bin;C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program
> Files (x86)\NVIDIA
> Corporation\PhysX\Common;C:\wamp64\bin\php\php7.4.0;C:\composer;C:\Program
> Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program
> Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program
> Files\Git\cmd;C:\Program Files\Microsoft VS
> Code\bin;C:\Users\PhpCoder\AppData\Local\Microsoft\WindowsApps;C:\Users\PhpCoder\AppData\Roaming\Composer\vendor\bin;C:\Users\PhpCoder\AppData\Roaming\npm;C:\Users\PhpCoder\AppData\Local\GitHubDesktop\bin
> 9 verbose lifecycle @~development: CWD:
> C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi 10
> silly lifecycle @~development: Args: [ 10 silly lifecycle   '/d /s
> /c', 10 silly lifecycle   'cross-env NODE_ENV=development
> node_modules/webpack/bin/webpack.js --progress --hide-modules
> --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"' 10 silly lifecycle ] 11 silly lifecycle @~development: Returned: code:
> 3221225725  signal: null 12 info lifecycle @~development: Failed to
> exec development script 13 verbose stack Error: @ 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"` 13 verbose stack Exit status 3221225725 13 verbose stack     at
> EventEmitter.<anonymous>
> (C:\Users\PhpCoder\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
> 13 verbose stack     at EventEmitter.emit (events.js:311:20) 13
> verbose stack     at ChildProcess.<anonymous>
> (C:\Users\PhpCoder\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
> 13 verbose stack     at ChildProcess.emit (events.js:311:20) 13
> verbose stack     at maybeClose (internal/child_process.js:1021:16) 13
> verbose stack     at Process.ChildProcess._handle.onexit
> (internal/child_process.js:286:5) 14 verbose pkgid @ 15 verbose cwd
> C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi 16
> verbose Windows_NT 10.0.18363 17 verbose argv "C:\\Program
> Files\\nodejs\\node.exe"
> "C:\\Users\\PhpCoder\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js"
> "run" "development" "--" "--watch" 18 verbose node v12.16.1 19 verbose
> npm  v6.14.4 20 error code ELIFECYCLE 21 error errno 3221225725 22
> error @ 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"` 22 error Exit status 3221225725 23 error Failed at the @ development
> script. 23 error This is probably not a problem with npm. There is
> likely additional logging output above. 24 verbose exit [ 3221225725,
> true ]




    0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\PhpCoder\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'watch'
1 verbose cli ]
2 info using npm@6.14.4
3 info using node@v12.16.1
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle @~prewatch: @
6 info lifecycle @~watch: @
7 verbose lifecycle @~watch: unsafe-perm in lifecycle true
8 verbose lifecycle @~watch: PATH: C:\Users\PhpCoder\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi\node_modules\.bin;C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi\node_modules\.bin;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\wamp64\bin\php\php7.4.0;C:\composer;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\Microsoft VS Code\bin;C:\Users\PhpCoder\AppData\Local\Microsoft\WindowsApps;C:\Users\PhpCoder\AppData\Roaming\Composer\vendor\bin;C:\Users\PhpCoder\AppData\Roaming\npm;C:\Users\PhpCoder\AppData\Local\GitHubDesktop\bin
9 verbose lifecycle @~watch: CWD: C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi
10 silly lifecycle @~watch: Args: [ '/d /s /c', 'npm run development -- --watch' ]
11 silly lifecycle @~watch: Returned: code: 3221225725  signal: null
12 info lifecycle @~watch: Failed to exec watch script
13 verbose stack Error: @ watch: `npm run development -- --watch`
13 verbose stack Exit status 3221225725
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\PhpCoder\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:311:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\PhpCoder\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:311:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid @
15 verbose cwd C:\Users\PhpCoder\Documents\GitHub\demandSystem\LDMS-DrMirMohammadi
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\PhpCoder\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch"
18 verbose node v12.16.1
19 verbose npm  v6.14.4
20 error code ELIFECYCLE
21 error errno 3221225725
22 error @ watch: `npm run development -- --watch`
22 error Exit status 3221225725
23 error Failed at the @ watch script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221225725, true ]

这是我的包json:

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "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": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "axios": "^0.19",
        "bootstrap": "^4.0.0",
        "cross-env": "^5.1",
        "js-md5": "^0.7.3",
        "laravel-mix": "^5.0.1",
        "lodash": "^4.17.13",
        "popper.js": "^1.12",
        "resolve-url-loader": "^2.3.1",
        "sass": "^1.20.1",
        "sass-loader": "^8.0.0",
        "vue": "^2.5.17",
        "vue-template-compiler": "^2.6.10"
    },
    "dependencies": {
        "vue-cryptojs": "^2.1.4",
        "vue-router": "^3.1.5",
        "vue2-editor": "^2.10.2",
        "vuetify": "^2.2.14",
        "vuex": "^3.1.3"
    }
}

我使用了此命令,但问题仍未解决:

  • 撰写者更新
  • rm -rf node_modules
  • npm缓存清理--force
  • npm安装
  • npm run dev

这是我的环境:

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:sBN8f2Gdkl0sO8iUaCbjOhnqDAR786DAxRfjrIDlkrw=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
GHASEDAK_API_KEY="${GHASEDAK_API_KEY}"
GHASEDAK_LINE_NUMBER="${GHASEDAK_LINE_NUMBER}"
GHASEDAK_LINE_NUMBERS="${GHASEDAK_LINE_NUMBERS}"

这是我的webpack.config.js

/**
 * As our first step, we'll pull in the user's webpack.mix.js
 * file. Based on what the user requests in that file,
 * a generic config object will be constructed for us.
 */
let mix = require('../src/index');

let ComponentFactory = require('../src/components/ComponentFactory');

new ComponentFactory().installAll();

require(Mix.paths.mix());

/**
 * Just in case the user needs to hook into this point
 * in the build process, we'll make an announcement.
 */

Mix.dispatch('init', Mix);

/**
 * Now that we know which build tasks are required by the
 * user, we can dynamically create a configuration object
 * for Webpack. And that's all there is to it. Simple!
 */

let WebpackConfig = require('../src/builder/WebpackConfig');

module.exports = new WebpackConfig().build();

1 个答案:

答案 0 :(得分:1)

尝试将sass软件包更新为最新版本。