鍍金池/ 問答/HTML/ next.js在macOS下運(yùn)行出錯(cuò)

next.js在macOS下運(yùn)行出錯(cuò)

cnpm run dev 運(yùn)行后出錯(cuò)

These relative modules were not found:

* ../../../../.4.1.4@next/dist/lib/error.js in ./node_modules/.4.1.4@next/dist/pages/_error.js?entry
* ../../../../.4.1.4@next/dist/server/document.js in ./node_modules/.4.1.4@next/dist/pages/_document.js?entry
(node:6711) DeprecationWarning: Module.chunks: Use Module.forEachChunk/mapChunks/getNumberOfChunks/isInChunk/addChunk/removeChunk instead

貌似是沒有找到模塊,重試了 cnpm install 也檢查了package.json 沒發(fā)現(xiàn)問題。

{
  "scripts": {
    "a": "next",
    "build": "next build",
    "start": "next start"
  },
  "dependencies": {
    "next": "^4.1.4",
    "react": "^16.1.0",
    "react-dom": "^16.1.0"
  }
}

然后我在另一臺 win10 上運(yùn)行,運(yùn)行成功,沒有問題!

很奇怪的現(xiàn)象,估計(jì)是我的環(huán)境問題,貌似是沒有找到 node_modules 目錄,報(bào)錯(cuò)里的 ../../../../ 應(yīng)該為 ./node_modules,但是不知道在哪里配置。

無解了,求助大神!

回答
編輯回答
笑忘初

自己解決了

sudo npm install -g npm
2018年4月12日 18:34